package com.ruoyi.eqmonitor.dtos;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 设备历史数据查询参数
 */
public class OptDeviceHistoryDto implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 开始时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @NotNull(message = "开始时间不允许为空")
    private Date startTime;

    /**
     * 结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @NotNull(message = "结束时间不允许为空")
    private Date endTime;

    /**
     * 监测指标编码
     */
    @NotNull(message = "监测指标编码不允许为空")
    private String monitorCode;

    /**
     * 设备编码集合
     */
    @NotEmpty(message = "设备列表不允许为空")
    private List<String> deviceCodes;

    /**
     * 降精度采样时间
     */
    private String downsample;

    /**
     * 聚合方式
     */
    private String aggregator;


    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getMonitorCode() {
        return monitorCode;
    }

    public void setMonitorCode(String monitorCode) {
        this.monitorCode = monitorCode;
    }

    public List<String> getDeviceCodes() {
        return deviceCodes;
    }

    public void setDeviceCodes(List<String> deviceCodes) {
        this.deviceCodes = deviceCodes;
    }

    public String getDownsample() {
        return downsample;
    }

    public void setDownsample(String downsample) {
        this.downsample = downsample;
    }

    public String getAggregator() {
        return aggregator;
    }

    public void setAggregator(String aggregator) {
        this.aggregator = aggregator;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OptDeviceHistoryDto that = (OptDeviceHistoryDto) o;
        return Objects.equals(startTime, that.startTime) && Objects.equals(endTime, that.endTime) && Objects.equals(monitorCode, that.monitorCode) && Objects.equals(deviceCodes, that.deviceCodes) && Objects.equals(downsample, that.downsample) && Objects.equals(aggregator, that.aggregator);
    }

    @Override
    public int hashCode() {
        return Objects.hash(startTime, endTime, monitorCode, deviceCodes, downsample, aggregator);
    }

    @Override
    public String toString() {
        return "OptDeviceHistoryDto{" +
                "startTime=" + startTime +
                ", endTime=" + endTime +
                ", monitorCode='" + monitorCode + '\'' +
                ", deviceCodes=" + deviceCodes +
                ", downsample='" + downsample + '\'' +
                ", aggregator='" + aggregator + '\'' +
                '}';
    }
}
